package com.note.user.service.impl;

import com.alibaba.fastjson.JSON;
import com.note.common.constants.RabbitConst;
import com.note.user.service.MqService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Package：com.note.user.service
 * @Name：MqServiceImpl
 * @Author：热伊木
 * @Email：uyevan@163.com
 * @Date：2024-05-01-19:21
 * @Description：
 */
@Service
public class MqServiceImpl implements MqService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void sendMessage(Object object) {
        rabbitTemplate.convertSendAndReceive(
                RabbitConst.RabbitMQDirectExchange,
                RabbitConst.RabbitMQDirectRouting, JSON.toJSONString(object));
    }
}
